package com.fsc.mapper;

import com.fsc.entity.domain.ChatFriend;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fsc.entity.vo.PersonContactListVO;
import com.fsc.entity.vo.PersonWaitAddListVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 86183
* @description 针对表【chat_friend(通讯录表)】的数据库操作Mapper
* @createDate 2024-06-14 11:20:07
* @Entity com.fsc.entity.domain.ChatFriend
*/
public interface ChatFriendMapper extends BaseMapper<ChatFriend> {


    @Select(" select j.friend_id,j.friend_nickname,l.icon_url " +
            "from login_info as l join ( " +
            "select friend_id,friend_nickname " +
            "from chat_friend where user_id =#{userId} and status=1 " +
            ") as j on l.id = j.friend_id ")
    List<PersonContactListVO> getContractList(Integer userId);

    @Select("select f.user_id,l.username,l.icon_url,f.say_hello from " +
            "chat_friend as f join login_info as l " +
            "on f.user_id=l.id " +
            "where f.friend_id = #{id} and f.status = 0 ")
    List<PersonWaitAddListVO> getWaitAddList(Integer id);


}





